import { CATEGORY_PORT } from "@/api/config/servicePort";
import http from "@/api";
import { Category } from "@/api/interface";

export const getCategoryList = (params: Category.ReqCategory) => {
  return http.post(CATEGORY_PORT + `/list`, params, { loading: false }); // 正常 post json 请求  ==>  application/json
};

export const getCategorySubList = () => {
  return http.get(CATEGORY_PORT + `/sub/list`);
};

export const addCategory = (params: Category.ResCategory) => {
  return http.post(CATEGORY_PORT + `/add`, params, { loading: false });
};

export const deleteCategory = (params: number[]) => {
  return http.post(CATEGORY_PORT + `/delete`, params, { loading: false });
};

export const editCategory = (params: Category.ReqCategory) => {
  return http.put(CATEGORY_PORT + `/edit`, params, { loading: false });
};
